Skip to content

tooling: Add Makefile and npm hooks for dev workflow.#229

Merged
nedseb merged 7 commits intomainfrom
tooling/makefile-npm-hooks
Mar 24, 2026
Merged

tooling: Add Makefile and npm hooks for dev workflow.#229
nedseb merged 7 commits intomainfrom
tooling/makefile-npm-hooks

Conversation

@nedseb
Copy link
Copy Markdown
Contributor

@nedseb nedseb commented Mar 24, 2026

Summary

Closes #201.

Unified developer tooling: Makefile as primary interface + npm for git hooks and release management.

Makefile (make help)

Commande Description
make install Install pip + npm dependencies
make prepare Install git hooks (husky)
make setup Full dev setup (install + prepare)
make lint / make lint-fix Ruff linter / auto-fix
make test Mock tests (info message suggests test-all)
make test-mock Mock tests only
make test-hardware All hardware tests (needs board on PORT)
make test-board Board tests (buttons, LEDs, buzzer, screen)
make test-sensors Sensor hardware tests (I2C devices)
make test-all All tests (mock + hardware)
make test-<scenario> Per-scenario target (e.g. make test-hts221)
make test-examples Validate example files
make ci Full CI pipeline (lint + tests + examples)
make build Build (lint + test)
make repl / make mount REPL / mount lib/
make clean / make deepclean Caches / everything including node_modules

Per-scenario targets (test-apds9960, test-hts221, etc.) are generated dynamically from tests/scenarios/*.yaml.

Git hooks (npm + husky)

  • commit-msg : commitlint (conventional commits, scopes per driver, max 78 chars, full stop allowed)
  • pre-commit : validate-branch-name + git-precommit-checks (conflict markers, TODO, "do not commit") + lint-staged (ruff on staged .py)

Configuration files

File Purpose
Makefile Primary command interface
env.mk Environment variables (PATH, PORT)
package.json npm scripts + devDependencies
commitlint.config.js Commit message rules (types, scopes, length)
.validate-branch-namerc.js Branch name patterns
git-precommit-checks.config.js Pre-commit content checks
.prettierrc.json Prettier config (JS/JSON/YAML)
.releaserc.json semantic-release config
.husky/commit-msg Commit-msg hook
.husky/pre-commit Pre-commit hook

npm devDependencies

husky, commitlint, commitizen, lint-staged, validate-branch-name, git-precommit-checks, prettier, semantic-release + plugins, cross-env

Test plan

  • make help — 19 targets displayed correctly
  • make lint — All checks passed
  • make test-mock — 164 passed
  • make test-examples — 191 passed
  • make ci — lint + tests + examples all green
  • make test — runs mock + displays info message
  • make test-apds9960 — dynamic target works (24 passed)
  • make test-hts221 — dynamic target works (26 passed)
  • commitlint rejects invalid / accepts valid messages
  • validate-branch-name accepts tooling/makefile-npm-hooks
  • git-precommit-checks detects TODO and conflict markers
  • make deepclean + make install reinstalls node_modules

Copilot AI review requested due to automatic review settings March 24, 2026 09:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a unified developer workflow for this MicroPython driver repository by introducing a root Makefile and Node-based Git hooks (Husky) to standardize common dev tasks and enforce commit/branch conventions.

Changes:

  • Add a root Makefile to wrap linting, testing (mock/hardware), examples validation, and board interaction commands.
  • Add package.json/package-lock.json plus commitlint.config.js to support Husky hooks, commitlint, lint-staged, and branch-name validation.
  • Add Husky hook scripts and update .gitignore for Node-related artifacts.

Reviewed changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
Makefile Introduces make install/lint/test/... commands for day-to-day development tasks.
package.json Adds devDependencies and config for husky, commitlint, lint-staged, branch validation, and precommit checks.
package-lock.json Locks npm dependency graph for reproducible installs.
commitlint.config.js Defines project-specific commitlint rules (types/scopes/length).
.husky/pre-commit Runs branch validation, precommit checks, and lint-staged.
.husky/commit-msg Enforces commit message format via commitlint.
.gitignore Ignores node_modules/ and a few additional artifacts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Makefile Outdated

.PHONY: install
install: ## Install dev tools and git hooks
pip install ruff pytest
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

install installs ruff/pytest without the repo’s pinned dev requirements and misses dependencies that the repo actually uses (e.g. pyyaml for tests and mpremote for repl/mount and hardware test runner). Consider installing from .github/workflows/requirements.txt (keeps versions aligned with CI) and include mpremote, using python -m pip to respect the active venv.

Suggested change
pip install ruff pytest
python3 -m pip install -r .github/workflows/requirements.txt mpremote

Copilot uses AI. Check for mistakes.
Comment thread Makefile Outdated

.PHONY: test-driver
test-driver: ## Run tests for one driver (usage: make test-driver DRIVER=hts221)
python3 -m pytest tests/ -v -k "$(DRIVER)" --port $(PORT) -s
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test-driver uses -k "$(DRIVER)", but this test suite already provides a dedicated --driver option in tests/conftest.py. Using -k will match substrings in nodeids and may select the wrong set of tests (or none). Switch this to --driver $(DRIVER) to match the documented/implemented driver filter.

Suggested change
python3 -m pytest tests/ -v -k "$(DRIVER)" --port $(PORT) -s
python3 -m pytest tests/ -v --driver $(DRIVER) --port $(PORT) -s

Copilot uses AI. Check for mistakes.
Comment thread .husky/pre-commit
@@ -0,0 +1 @@
npx --no-install validate-branch-name && npx --no-install git-precommit-checks && npx --no-install lint-staged
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These Husky hook files don’t include a shebang (e.g. #!/usr/bin/env sh). Depending on platform and how Git executes the hook, a missing shebang can cause the hook to fail to run. Add the standard Husky header (and any required initialization for your Husky major version) so the hooks execute reliably.

Copilot uses AI. Check for mistakes.
Comment thread .husky/commit-msg
@@ -0,0 +1 @@
npx --no-install commitlint --edit "$1"
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Husky hook file doesn’t include a shebang (e.g. #!/usr/bin/env sh). Depending on platform and how Git executes the hook, a missing shebang can cause the hook to fail to run. Add the standard Husky header (and any required initialization for your Husky major version) so the hook executes reliably.

Copilot uses AI. Check for mistakes.
Comment thread commitlint.config.js
'subject-full-stop': [0],
'header-max-length': [2, 'always', 78],
'scope-enum': [
1,
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scope-enum is configured with severity 1 (warning), which means invalid scopes will typically not fail the commit-msg hook. If the intent is to enforce the allowed scopes (as described in the PR), set the rule severity to 2 so invalid scopes are rejected.

Suggested change
1,
2,

Copilot uses AI. Check for mistakes.
Comment thread package.json
"@commitlint/config-conventional": "^20.5.0",
"git-precommit-checks": "^3.1.0",
"husky": "^9.1.7",
"lint-staged": "^16.4.0",
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lint-staged@16.4.0 pulls in a Node engine requirement of >=20.17 (per package-lock.json). Since this repo previously didn’t declare a Node version, developers on Node 18 LTS will hit install/runtime errors unexpectedly. Consider either pinning lint-staged to a version compatible with your supported Node range, or declaring an explicit engines.node in package.json.

Suggested change
"lint-staged": "^16.4.0",
"lint-staged": "^15.0.0",

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3761702976

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Makefile Outdated

.PHONY: install
install: ## Install dev tools and git hooks
pip install ruff pytest
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Install PyYAML in dev setup target

make install currently installs only ruff and pytest, but the test suite imports yaml (for example in tests/conftest.py and tests/test_scenarios.py). On a fresh environment, following this new workflow causes make test to fail with ModuleNotFoundError: No module named 'yaml', so the advertised setup target does not actually provision the dependencies needed for testing.

Useful? React with 👍 / 👎.

Comment thread commitlint.config.js
Comment on lines +33 to +37
'type-enum': [
2,
'always',
[
'build',
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Allow existing scope-only commit subjects

The new type-enum restricts the leading token to conventional types and excludes driver scopes (e.g. hts221, ism330dl), so commit messages in the repository’s established <scope>: <Description.> format are rejected by the new commit-msg hook. This blocks contributors using the documented/project-native format unless they switch to a different convention, which creates workflow breakage.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ba7feea0f2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Makefile

.PHONY: prepare
prepare: ## Install git hooks
husky
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Run Husky via npm exec in prepare target

make setup invokes prepare directly from make, but husky is only installed in node_modules/.bin and that directory is not on PATH outside npm lifecycle scripts. In a normal fresh checkout this makes make setup fail at prepare with husky: No such file or directory, even after npm install; call Husky through npx --no-install husky (or npm exec husky) here so the advertised setup command works reliably.

Useful? React with 👍 / 👎.

Comment thread Makefile Outdated

.PHONY: install
install: ## Install dev tools (pip + npm)
pip install ruff pytest
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Install Python tools with the same interpreter used for tests

The Makefile installs dependencies with bare pip but runs tests with python3 -m pytest; on systems where pip targets a different interpreter (or is missing while only pip3 exists), make install succeeds/fails inconsistently and make test can still raise missing-module errors. Installing via python3 -m pip keeps the environment aligned with the test runner.

Useful? React with 👍 / 👎.

@nedseb
Copy link
Copy Markdown
Contributor Author

nedseb commented Mar 24, 2026

Note: the commit message format between commitlint (conventional commits) and the existing CI check (check-commits.yml) is not yet harmonized. This will be addressed in #231.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7122f59b79

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Makefile

# Dynamic per-scenario targets (test-apds9960, test-hts221, etc.)
SCENARIOS := $(basename $(notdir $(wildcard tests/scenarios/*.yaml)))
$(foreach s,$(SCENARIOS),$(eval .PHONY: test-$(s))$(eval test-$(s): ; python3 -m pytest tests/ -v -k "$(s)" --port $$(PORT) -s))
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Match per-scenario filters to pytest scenario IDs

The generated test-<scenario> targets filter with -k "$(s)", where $(s) comes from the YAML filename stem, but test IDs are built from scenario name/driver (tests/test_scenarios.py), not necessarily from the filename. For example, tests/scenarios/wsen_hids.yaml uses driver: wsen-hids and tests/scenarios/board_temperature_comparison.yaml uses name: "Temperature comparison (all sensors)", so make test-wsen_hids and make test-board_temperature_comparison can select zero tests and fail with "no tests collected". Use the same identifier source as pytest (or --driver) when generating these targets.

Useful? React with 👍 / 👎.

Comment thread Makefile
Comment on lines +56 to +60
python3 -m pytest tests/ -v --port $(PORT) -s -k "board_ and hardware"

.PHONY: test-sensors
test-sensors: ## Run sensor driver hardware tests (I2C devices)
python3 -m pytest tests/ -v --port $(PORT) -s -k "hardware and not board_"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Select board tests by marker instead of name substring

These targets split board vs sensor suites using -k substring checks on board_, but board scenarios are identified by the board marker in the test generator (tests/test_scenarios.py marks board scenarios explicitly). Any board scenario whose ID does not contain board_ (e.g. name: "Temperature comparison (all sensors)") is omitted from test-board and incorrectly included by test-sensors, so both commands run the wrong scope. Use marker-based filtering (-m board and -m "hardware and not board") to make the target behavior correct.

Useful? React with 👍 / 👎.

Comment thread Makefile Outdated
# --- Setup ---

# npm install is re-run only when package.json changes
node_modules/.package-lock.json: package.json
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reinstall npm deps when lockfile changes

The dependency stamp for node_modules/.package-lock.json only depends on package.json, so a pulled change that updates package-lock.json without changing package.json will not trigger npm install. That leaves node_modules potentially out of sync with the repository lockfile and can cause hook/tooling version drift between contributors. Include package-lock.json as a prerequisite (or avoid this stamp pattern) so installs remain reproducible.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

@nedseb nedseb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed Copilot feedback:

  1. pyyaml/mpremote missing — Fixed: make install now uses python3 -m pip install -e ".[dev,test]" which installs all deps from pyproject.toml extras.

  2. test-driver uses -k instead of --driver — Good catch but -k is intentional here: it also matches board scenarios (e.g. make test-board_buttons). The dynamic targets handle per-driver testing.

  3. Husky shebang — Added #!/usr/bin/env sh to both hooks.

  4. scope-enum severity 1 — Kept at 1 (warning) intentionally to let the team adopt gradually. Will be enforced as error in a future PR (tracked in #232).

  5. lint-staged Node >= 20.17 — Added engines.node in package.json to make this explicit.

  6. type-enum blocks old format — Known issue, tracked in #231.

  7. prepare — husky not in PATH — Already handled by env.mk which adds node_modules/.bin to PATH.

  8. python3 -m pip instead of pip — Fixed.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 17 changed files in this pull request and generated 10 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Makefile

# Dynamic per-scenario targets (test-apds9960, test-hts221, etc.)
SCENARIOS := $(basename $(notdir $(wildcard tests/scenarios/*.yaml)))
$(foreach s,$(SCENARIOS),$(eval .PHONY: test-$(s))$(eval test-$(s): ; python3 -m pytest tests/ -v -k "$(s)" --port $$(PORT) -s))
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dynamic per-scenario targets are generated from YAML filenames (e.g. wsen_hids.yaml -> make test-wsen_hids), but pytest IDs use scenario.get('name', scenario.get('driver', ...)). For wsen_hids.yaml/wsen_pads.yaml, driver is wsen-hids/wsen-pads, so -k "wsen_hids" won't match and the generated make targets won't run any tests. Consider generating targets from the scenario name/driver fields (parsed from YAML) or aligning filenames/name with the driver string used in test IDs (e.g., rename YAMLs or add a name: matching the filename).

Suggested change
$(foreach s,$(SCENARIOS),$(eval .PHONY: test-$(s))$(eval test-$(s): ; python3 -m pytest tests/ -v -k "$(s)" --port $$(PORT) -s))
$(foreach s,$(SCENARIOS),$(eval .PHONY: test-$(s))$(eval test-$(s): ; python3 -m pytest tests/ -v -k "$(s) or $(subst _,-,$(s))" --port $$(PORT) -s))

Copilot uses AI. Check for mistakes.
Comment thread .releaserc.json Outdated
{
"branches": ["main"],
"repositoryUrl": "https://github.com/steamicc/micropython-steami-lib.git",
"debug": "false",
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In semantic-release config, debug should be a boolean, but it's currently the string "false". As written, semantic-release will treat it as truthy and may enable debug logging unexpectedly. Change it to the JSON boolean false.

Suggested change
"debug": "false",
"debug": false,

Copilot uses AI. Check for mistakes.
Comment on lines +11 to +26
message: 'Aurais-tu oublié de terminer certaines tâches ? Aurais-tu une issue à ouvrir pour traiter cette tache plus tard ?',
nonBlocking: true,
regex: /(?:FIXME|TODO)/,
},
{
message: 'Tu as des marqueurs de conflits qui traînent dans ton code',
regex: /^[<>|=]{4,}/m,
},
{
message:
'Arrêt du commit : tu as renseigné des choses qui ne doivent pas être commitées !',
regex: /do[\s]not[\s]commit/i,
},
{
filter: /\.js$/,
message: '🤔 Hum ! N’as-tu pas oublié de retirer du "console.log(…)" ?',
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pre-commit messages are written in French and include emojis. Most repo documentation and tooling output is in English, so this can be confusing for contributors and CI logs. Consider switching these messages to English (or making the language configurable) and keeping output plain-text for maximum compatibility.

Suggested change
message: 'Aurais-tu oublié de terminer certaines tâches ? Aurais-tu une issue à ouvrir pour traiter cette tache plus tard ?',
nonBlocking: true,
regex: /(?:FIXME|TODO)/,
},
{
message: 'Tu as des marqueurs de conflits qui traînent dans ton code',
regex: /^[<>|=]{4,}/m,
},
{
message:
'Arrêt du commit : tu as renseigné des choses qui ne doivent pas être commitées !',
regex: /do[\s]not[\s]commit/i,
},
{
filter: /\.js$/,
message: '🤔 Hum ! N’as-tu pas oublié de retirer du "console.log()" ?',
message: 'Did you forget to finish some tasks? Should you open an issue to handle this later?',
nonBlocking: true,
regex: /(?:FIXME|TODO)/,
},
{
message: 'You still have conflict markers left in your code.',
regex: /^[<>|=]{4,}/m,
},
{
message:
'Commit stopped: you have included content that must not be committed.',
regex: /do[\s]not[\s]commit/i,
},
{
filter: /\.js$/,
message: 'Have you forgotten to remove a "console.log(...)" statement?',

Copilot uses AI. Check for mistakes.
},
{
filter: /\.js$/,
message: '🤔 Hum ! N’as-tu pas oublié de retirer du "console.log(…)" ?',
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

console.log rule message also contains an emoji and uses a curly apostrophe (N’as-tu). Depending on terminal/font/encoding this can render poorly in hook output. Consider using ASCII-safe punctuation and consistent language with the rest of the repo.

Suggested change
message: '🤔 Hum ! Nas-tu pas oublié de retirer du "console.log()" ?',
message: 'Hum ! N\'as-tu pas oublié de retirer du "console.log(...)" ?',

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,4 @@
module.exports = {
pattern: "^(main)$|^(feat|fix|docs|tooling|ci|test|style|chore|refactor)\/([a-z0-9]+-)*[a-z0-9]+$|^release\/v([0-9]+)\\.([0-9]+)\\.([0-9]+)([a-z0-9-]*)$",
errorMsg: "🤨 La branche que tu essaies de pusher ne respecte pas nos conventions, tu peux la renommer avec `git branch -m <nom-actuel> <nouveau-nom>`",
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Branch-name validation error message is in French and includes emojis, while the repo docs are primarily English. Consider switching to an English message (or making language configurable) so the hook output is understandable for all contributors.

Suggested change
errorMsg: "🤨 La branche que tu essaies de pusher ne respecte pas nos conventions, tu peux la renommer avec `git branch -m <nom-actuel> <nouveau-nom>`",
errorMsg: "The branch name does not follow our conventions. You can rename it with: `git branch -m <current-name> <new-name>`",

Copilot uses AI. Check for mistakes.
Comment thread Makefile
Comment on lines +21 to +24
.PHONY: install
install: node_modules/.package-lock.json ## Install dev tools (pip + npm)
python3 -m pip install -e ".[dev,test]"

Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pip install -e ... can pick up the wrong Python environment (e.g., if pip points to a different interpreter than python3). Using python3 -m pip install -e ... (or $(PYTHON) -m pip with a configurable PYTHON var) makes the install target more reliable.

Copilot uses AI. Check for mistakes.
Comment thread Makefile

.PHONY: prepare
prepare: node_modules/.package-lock.json ## Install git hooks
husky
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prepare runs husky with no arguments. Husky typically needs an explicit install step (e.g. setting core.hooksPath and creating .husky/_) for hooks to actually run; calling husky alone is likely a no-op or help output. Please ensure make prepare performs the actual installation step so git hooks are activated after make setup.

Suggested change
husky
husky install

Copilot uses AI. Check for mistakes.
Comment thread CONTRIBUTING.md Outdated
Comment on lines +63 to +71
Commit messages follow the [Conventional Commits](https://www.conventionalcommits.org/) format, enforced by commitlint via a git hook:

```
<scope>: <Description starting with a capital letter ending with a period.>
<type>(<scope>): <Description starting with a capital letter ending with a period.>
```

The scope is the driver name or domain (`hts221`, `ism330dl`, `docs`, `tests`, `ci`...). There is no predefined list of types — the scope is free-form.
**Types**: `feat`, `fix`, `docs`, `style`, `refactor`, `test`, `ci`, `build`, `chore`, `perf`, `revert`, `tooling`

**Scopes**: driver names (`hts221`, `ism330dl`, `wsen-pads`...) or domains (`ci`, `docs`, `style`, `tests`, `tooling`).
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documented commit format shows <type>(<scope>): ..., but the examples include docs: ... (no scope). Conventional Commits makes scope optional, and commitlint typically doesn't require it unless explicitly configured. Suggest updating the docs to indicate that (scope) is optional (and clarify whether you want to require it or not).

Copilot uses AI. Check for mistakes.
Comment thread CONTRIBUTING.md Outdated
5. Push your branch to the repository
6. Open a Pull Request
1. Set up your environment: `make setup`
2. Create a branch from main (format: `feat/`, `fix/`, `docs/`, `tooling/`, `ci/`, `test/`, `style/`)
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Workflow section lists allowed branch prefixes as feat/, fix/, docs/, tooling/, ci/, test/, style/, but the actual validation regex also allows chore/ and refactor/. Align the documentation with the enforced pattern so contributors don't get surprised by hooks rejecting/accepting names differently.

Suggested change
2. Create a branch from main (format: `feat/`, `fix/`, `docs/`, `tooling/`, `ci/`, `test/`, `style/`)
2. Create a branch from main (format: `feat/`, `fix/`, `docs/`, `tooling/`, `ci/`, `test/`, `style/`, `chore/`, `refactor/`)

Copilot uses AI. Check for mistakes.
Comment thread env.mk Outdated
@@ -0,0 +1,2 @@
export PATH := $(shell pwd)/node_modules/.bin:$(PATH)
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using $(shell pwd) makes Make spawn a subshell at parse time and can behave unexpectedly if make is invoked with a different working directory. $(CURDIR) is the standard Make built-in for the current directory and is usually more portable/reliable for constructing PATH.

Suggested change
export PATH := $(shell pwd)/node_modules/.bin:$(PATH)
export PATH := $(CURDIR)/node_modules/.bin:$(PATH)

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

@nedseb nedseb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed Codex feedback:

  1. P1 — Install PyYAML — Already fixed: make install uses pip install -e ".[dev,test]" which includes pyyaml.

  2. P2 — Allow existing scope-only commits — Known issue, tracked in #231.

  3. P1 — Run Husky via npm exec — Already handled: env.mk adds node_modules/.bin to PATH, so husky is found directly.

  4. P2 — python3 -m pip — Fixed in previous commit.

  5. P1 — Per-scenario filters match pytest IDs — Fixed: dynamic targets now use the driver field from YAML (for driver scenarios) or the filename stem (for board scenarios). The board_temperature_comparison.yaml name field was aligned with the filename. Convention documented in TESTING.md.

  6. P1 — Board tests by marker — The -k board_ filter works correctly for all board scenarios now that names are aligned with filenames. Marker-based filtering would require changes to the test generator which is out of scope.

  7. P2 — Reinstall on lockfile change — Fixed: package-lock.json added as prerequisite to the npm install target.

Copy link
Copy Markdown
Contributor Author

@nedseb nedseb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed second round of Copilot feedback (214fca4):

  1. Dynamic targets use filenames — Already fixed in previous commit (uses driver field).
  2. .releaserc.json debug string — Fixed: changed "false" to false.
  3. French messages + emojis in hooks — Kept intentionally: consistent with makecode-steami config. All STeaMi repos use French for developer-facing messages.
  4. pip vs python3 -m pip — Already fixed.
  5. husky no-op — Husky v9 installs hooks with just husky (no husky install needed).
  6. Scope optional not documented — Fixed: format shows [(<scope>)] with note that scope is optional.
  7. Branch prefixes incomplete — Fixed: added chore/ and refactor/ to documentation.
  8. $(shell pwd)$(CURDIR) — Fixed in env.mk.

@nedseb nedseb merged commit c77dec0 into main Mar 24, 2026
3 checks passed
@nedseb nedseb deleted the tooling/makefile-npm-hooks branch March 24, 2026 11:19
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 214fca414b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .husky/pre-commit
Comment on lines +1 to +2
#!/usr/bin/env sh
npx --no-install validate-branch-name && npx --no-install git-precommit-checks && npx --no-install lint-staged
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Mark Husky hook scripts executable

These hook files were added with mode 100644, so Git ignores them instead of executing them (.husky/pre-commit/.husky/commit-msg are treated as non-executable). In a fresh clone this means the new commit-msg and pre-commit checks are silently bypassed, so invalid commit messages and unlinted staged Python changes can still be committed even after make setup.

Useful? React with 👍 / 👎.

Comment thread Makefile
Comment on lines +10 to +12
node_modules/.package-lock.json: package.json package-lock.json
npm install
@touch $@
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Fail fast when npm install fails in setup target

Because .ONESHELL is enabled globally, this multi-line recipe runs in one shell without -e; if npm install fails but node_modules/ already exists, the subsequent touch still succeeds and the target exits 0, leaving a false success stamp. That can make make install/make setup proceed with stale or missing Node tooling while reporting success, which breaks the reproducibility this target is meant to provide.

Useful? React with 👍 / 👎.

@semantic-release-updater
Copy link
Copy Markdown

🎉 This PR is included in version 0.0.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tooling: Add Makefile for common development commands.

2 participants